;
; SYSLIB Module Name:  SPA2HC
; Author:  Richard Conn
; SYSLIB Version Number:  2.0
; Module Version Number:  1.0
; Module Entry Points:
;	PA2HC
; Module External References:
;	COUT		EN
;

;
;  PA2HC --
;	PRINT REG A AS 2 HEXADECIMAL CHARACTERS
;
	EXT	COUT
	EXT	EN

PA2HC::
	PUSH	PSW	; SAVE A
	PUSH	PSW
	CALL	EN	; EXCHANGE NYBBLES
	CALL	PAHC	; PRINT LOW-ORDER NYBBLE AS HEX
	POP	PSW	; GET A
	CALL	PAHC	; PRINT LOW-ORDER NYBBLE AS HEX
	POP	PSW	; RESTORE A
	RET
PAHC:	ANI	0FH	; MASK FOR LOW NYBBLE
	CPI	10	; LETTER OR DIGIT?
	JC	PADIG	; DIGIT IF CARRY
	ADI	'A'-10	; CONVERT TO 'A'-'F'
	CALL	COUT	; PRINT
	RET
PADIG:	ADI	'0'	; CONVERT TO '0'-'9'
	CALL	COUT	; PRINT
	RET

	END
